  
function inputfocus(target){
	var inputwrap = document.getElementById("input"+target);
	var inputalarm = document.getElementById("alarm"+target);
	var focustime = inputwrap.className;
	
	  if(focustime=="notfocus"){
	    inputalarm.innerHTML="";
	    inputwrap.style.color="#000";
		inputwrap.value="";
		inputwrap.className="";
		if(target==3){
		   document.getElementById("passlevel").style.display="block";	
		   inputalarm.style.display="none";
		}
	    }
	else{
		inputalarm.innerHTML="";
	    inputwrap.style.color="#000";
		if(target==3){
		   document.getElementById("passlevel").style.display="block";	
		   inputalarm.style.display="none";
		}
	  }
}
function inputblur(target){
	var inputalarm = document.getElementById("alarm"+target);
	var inputwrap = document.getElementById("input"+target);
	if(inputwrap.value==""){
	   switch(target){
		case 1:inputalarm.innerHTML="请输入邮箱";break;
		case 2:inputalarm.innerHTML="请输入用户名";break; 
		case 3:document.getElementById("passlevel").style.display="none";inputalarm.style.display="block";inputalarm.innerHTML="请输入密码";break; 
		case 4:inputalarm.innerHTML="请再次输入密码";break;
		case 5:inputalarm.innerHTML="请输入验证码";break;  
	   }
	}else{
		if(target==1){
		   var mail = /^([a-zA-Z0-9]+[_|\_|\.]?)*[a-zA-Z0-9]+@([a-zA-Z0-9]+[_|\_|\.]?)*[a-zA-Z0-9]+\.[a-zA-Z]{2,3}$/;
           var mymail = inputwrap.value;
		   if(!mail.test(mymail)){
			   inputalarm.innerHTML="输入的邮箱无效，请重新输入"; }  
	    }
	   if(target==2){
		  var myname = inputwrap.value;
		  var spacereg = /^\s*(\S+)\s*$/;
		  var numreg = /^[0-9]*[0-9]$/;
		  if(myname.length<6){
			   inputalarm.innerHTML="用户名长度不能小于6个字符";  
		  }else if(myname.length>20){
			   inputalarm.innerHTML="用户名长度不能大于20个字符"; 
		  }else if(!spacereg.test(myname)){
		       inputalarm.innerHTML="用户名不能包含空格"; 
		  }else if(numreg.test(myname)){
			   inputalarm.innerHTML="用户名不能全为数字";
		  }
	   }
	   if(target==3){
		  var mypass = inputwrap.value;
		  if(mypass.length<6||mypass.length>20){
			    document.getElementById("passlevel").style.display="none";
			    inputalarm.style.display="block";
			    inputalarm.innerHTML="密码长度控制在6到20个字符之间";
		  }
	   }
	   if(target==4){
		  var myconpass = inputwrap.value;
		  var mypass = document.getElementById("input3");
		  if(myconpass!=mypass){
			  inputalarm.innerHTML="两次密码输入不一致";
		  }
	   }
	}
}
function passlevel(){
	       var mypass = document.getElementById("input3").value;
		   var levelscore = document.getElementById("levelscore");
		   var score = 0;
		   if (mypass.length > 10) score++;
           if ( ( mypass.match(/[a-z]/) ) || ( mypass.match(/[A-Z]/) ) ) score++;
           if (mypass.match(/\d+/)) score++;
           if ( mypass.match(/.[!,@,#,$,%,^,&,*,?,_,~,-,(,)]/) ) score++;
		   
           switch(score){
			case 0:
			     levelscore.innerHTML="";
				 document.getElementById("level0").style.background="";
				 document.getElementById("level1").style.background="";
				 document.getElementById("level2").style.background="";
				 document.getElementById("level3").style.background="";
				 document.getElementById("level4").style.background="";
				  break;
			case 1:
			      levelscore.innerHTML="低";
				 document.getElementById("level0").style.background="#2CD01A";
				 document.getElementById("level1").style.background="";
				 document.getElementById("level2").style.background="";
				 document.getElementById("level3").style.background="";
				 document.getElementById("level4").style.background="";
				  break;
			case 2:
			     levelscore.innerHTML="中";
				 document.getElementById("level0").style.background="#2CD01A";
				 document.getElementById("level1").style.background="#D2E14A";
				 document.getElementById("level2").style.background="";
				 document.getElementById("level3").style.background="";
				 document.getElementById("level4").style.background="";
				 break;
			case 3:levelscore.innerHTML="较高";
			     document.getElementById("level0").style.background="#2CD01A";
				 document.getElementById("level1").style.background="#D2E14A";
				 document.getElementById("level2").style.background="#FC6";
				 document.getElementById("level3").style.background="";
				 document.getElementById("level4").style.background="";
				 break;
			case 4:levelscore.innerHTML="高";
			     document.getElementById("level0").style.background="#2CD01A";
				 document.getElementById("level1").style.background="#D2E14A";
				 document.getElementById("level2").style.background="#FC6";
				 document.getElementById("level3").style.background="#F90";
				 document.getElementById("level4").style.background="";
				 break;
			
		   }
}
function starttip(target){
	
	var tip = document.getElementById("tip"+target);
	for(var i=1;i<=3;i++){
	    var temp = document.getElementById("tip"+i);	
		temp.style.display="none";
	}
	tip.style.display="block";
}
function endtip(){
	for(var i=1;i<=3;i++){
	    var temp = document.getElementById("tip"+i);	
		temp.style.display="none";
	}
}


